//
//  Untitled.swift
//  FiveoSocket
//
//  Created by 张朋朋 on 3/20/25.
//
import CommonBasicModule
import RouterService
import UIKit
import ConstantModule
//class SceneSayModelManager {
//    static let share  = SceneSayModelManager()
//    private var model: SceneSayModel?
//    func load(block:(SceneSayModel) -> Void){
//        if let model = model {
//            block(model)
//        }else{
//            loadLocalJSONFile(filename: "tts", bundle: Bundle.module, type: SceneSayModel.self) { localmodel in
//                model = localmodel
//                block(localmodel)
//            }
//        }
//    }
//    func mathSceneRandom(type: SceneType, currentts: TTSType, block: ((_ ttsname: String) -> Void)?) {
//        if App.shared.environment.contains(.showCaseRelease) {
//            block?("")
//            return
//        }
//        load { _ in
//            var sayit = model?.pictureBookExplanation.content?.randomElement() ?? ""
//            switch type {
//            case .pictureBookExplanation:
//                sayit = model?.pictureBookExplanation.content?.randomElement() ?? ""
//            case .translation:
//                sayit = model?.translation.content?.randomElement() ?? ""
//            case .cultureAndTourism:
//                sayit = model?.cultureAndTourism.content?.randomElement() ?? ""
//            default:
//                let tts = currentts// 当前音色
//                let content = model?.audioVideoScene?.filter({
//                    $0.voice == tts.voiceType
//                }).first?.content?.randomElement() ?? ""
//                sayit = content
//            }
//            block?(sayit)
//        }
//        
//    }
//    public  func loadLocalJSONFile<T: CustomMappable>(filename: String,
//                                                            bundle: Bundle, type: T.Type,
//                                                      finashBlock: ((_ localmodel: T) -> Void)) {
//        // 确定 JSON 文件的路径
//        guard let fileUrl = bundle.url(forResource: filename, withExtension: "json") else {
//            print("找不到文件")
//            return
//        }
//        do {
//            // 读取文件内容
//            let data = try Data(contentsOf: fileUrl)
//            // 使用 JSONDecoder 解析数据
//            if let object = try? JSONDecoder().decode(T.self, from: data) {
//                finashBlock(object)
//            }
//        } catch {
//            print("解析错误: \(error)")
//        }
//    }
//}
class SceneSayModel: CustomMappable {
    
    var pictureBookExplanation :Item
    var cultureAndTourism :Item
    var translation :Item
    
    var audioVideoScene :[Item]?
    
    
}
class Item: CustomMappable {
    @Default<String> var voice :String
    var content :[String]?
}
